package com.mysite.seckill.web.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.mysite.seckill.commons.po.User;

@Mapper
public interface UserMapper {

    @Insert("INSERT INTO user(username, password) VALUES (#{username}, #{password})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    public int insertUser(User user);

    @Select("SELECT id, username, nickname FROM user WHERE username = #{username} and password = #{password}")
    public User login(@Param("username") String username, @Param("password") String password);
}
